package cn.funnyxb.powerremember.uis.task.taskEdit.alarm;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.provider.Settings.System;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import cn.funnyxb.powerremember.beans.AlarmInfo;
import cn.funnyxb.tools.appFrame.App;
import cn.funnyxb.tools.appFrame.activityFrame.ActivitysHolder;
import com.mobclick.android.MobclickAgent;

public class AlarmEditActivity extends Activity
{
  public static String EXTRA_ALARMINFO = "alarminfo";
  public static String EXTRA_EDITINGPOS = "editingpos";
  private AlarmInfo alarmInfo = null;
  private int editingItemPos = -2;
  private CompoundButton.OnCheckedChangeListener onCheckedChangeListener = new 2(???);
  private View.OnClickListener onClickListenr = new 1(???);

  private void checkExtraData()
  {
    this.alarmInfo = ((AlarmInfo)getIntent().getSerializableExtra(EXTRA_ALARMINFO));
    this.editingItemPos = getIntent().getIntExtra(EXTRA_EDITINGPOS, -2);
    if ((this.alarmInfo != null) && (this.editingItemPos >= -1))
      return;
    Toast.makeText(this, 2131034147, 1).show();
    finish();
  }

  private void initClickListener()
  {
    findViewById(2131165313).setOnClickListener(this.onClickListenr);
    findViewById(2131165317).setOnClickListener(this.onClickListenr);
    findViewById(2131165321).setOnClickListener(this.onClickListenr);
    findViewById(2131165325).setOnClickListener(this.onClickListenr);
    findViewById(2131165328).setOnClickListener(this.onClickListenr);
    findViewById(2131165331).setOnClickListener(this.onClickListenr);
    findViewById(2131165310).setOnClickListener(this.onClickListenr);
    findViewById(2131165311).setOnClickListener(this.onClickListenr);
    ((CheckBox)findViewById(2131165322)).setOnCheckedChangeListener(this.onCheckedChangeListener);
    ((CheckBox)findViewById(2131165326)).setOnCheckedChangeListener(this.onCheckedChangeListener);
    ((CheckBox)findViewById(2131165329)).setOnCheckedChangeListener(this.onCheckedChangeListener);
    ((CheckBox)findViewById(2131165332)).setOnCheckedChangeListener(this.onCheckedChangeListener);
  }

  private void initFrame()
  {
    setContentView(2130903054);
    setTitle(getString(2131034112) + "--" + getString(2131034237));
    setUI_time(this.alarmInfo.getTime_hh(), this.alarmInfo.getTime_mm());
    setUI_repeat(this.alarmInfo.getRepeatText(this));
    if (this.alarmInfo.isWorkOnlyWhenDelay());
    for (boolean bool = false; ; bool = true)
    {
      setUI_progress(bool);
      setUI_ring(this.alarmInfo.isRing());
      setUI_shake(this.alarmInfo.isShake());
      setUI_oil(this.alarmInfo.isRandomOil(), this.alarmInfo.getMemo());
      initClickListener();
      return;
    }
  }

  private void returnValue()
  {
    Intent localIntent = new Intent();
    localIntent.putExtra(EXTRA_EDITINGPOS, this.editingItemPos);
    localIntent.putExtra(EXTRA_ALARMINFO, this.alarmInfo);
    setResult(-1, localIntent);
    finish();
  }

  private void setUI_oil(boolean paramBoolean, String paramString)
  {
    ((CheckBox)findViewById(2131165332)).setChecked(paramBoolean);
    if (paramBoolean)
      ((TextView)findViewById(2131165334)).setText("");
    while (true)
    {
      return;
      if (paramString == null)
        continue;
      ((TextView)findViewById(2131165334)).setText(getString(2131034238) + ":" + paramString);
    }
  }

  private void setUI_progress(boolean paramBoolean)
  {
    ((CheckBox)findViewById(2131165322)).setChecked(paramBoolean);
  }

  private void setUI_repeat(String paramString)
  {
    ((TextView)findViewById(2131165320)).setText(paramString);
  }

  private void setUI_ring(boolean paramBoolean)
  {
    ((CheckBox)findViewById(2131165326)).setChecked(paramBoolean);
  }

  private void setUI_shake(boolean paramBoolean)
  {
    ((CheckBox)findViewById(2131165329)).setChecked(paramBoolean);
  }

  private void setUI_time(int paramInt1, int paramInt2)
  {
    TextView localTextView = (TextView)findViewById(2131165316);
    String str1;
    label20: StringBuilder localStringBuilder;
    if (paramInt1 < 10)
    {
      str1 = "0";
      localStringBuilder = new StringBuilder(String.valueOf(str1)).append(paramInt1).append(":");
      if (paramInt2 >= 10)
        break label79;
    }
    for (String str2 = "0"; ; str2 = "")
    {
      localTextView.setText(str2 + paramInt2);
      return;
      str1 = "";
      label79: break label20:
    }
  }

  private void showOilEditDialog()
  {
    EditText localEditText = new EditText(this);
    localEditText.setText(AlarmOils.getRandom(this));
    new AlertDialog.Builder(this).setTitle(2131034241).setView(localEditText).setPositiveButton(2131034133, new 5(this, localEditText)).create().show();
  }

  private void showTimePicker()
  {
    String str = Settings.System.getString(getContentResolver(), "time_12_24");
    if ((str != null) && (str.equals("24")));
    for (boolean bool = true; ; bool = false)
    {
      new TimePickerDialog(this, new 3(this), this.alarmInfo.getTime_hh(), this.alarmInfo.getTime_mm(), bool).show();
      return;
    }
  }

  private void showWeekPciker()
  {
    ScrollView localScrollView = new ScrollView(this);
    LinearLayout localLinearLayout = new LinearLayout(this);
    localScrollView.addView(localLinearLayout);
    localLinearLayout.setOrientation(1);
    String[] arrayOfString = getResources().getStringArray(2130968576);
    boolean[] arrayOfBoolean = this.alarmInfo.getRepeatValueInBoolean();
    CheckBox[] arrayOfCheckBox = new CheckBox[7];
    for (int i = 0; ; ++i)
    {
      if (i > 6)
      {
        new AlertDialog.Builder(this).setTitle(2131034240).setView(localScrollView).setPositiveButton(2131034133, new 4(this, arrayOfBoolean, arrayOfCheckBox)).create().show();
        return;
      }
      arrayOfCheckBox[i] = new CheckBox(this);
      arrayOfCheckBox[i].setTextAppearance(this, 16973890);
      arrayOfCheckBox[i].setText(arrayOfString[i]);
      arrayOfCheckBox[i].setChecked(arrayOfBoolean[i]);
      localLinearLayout.addView(arrayOfCheckBox[i]);
    }
  }

  private void submit()
  {
    CheckBox localCheckBox1 = (CheckBox)findViewById(2131165326);
    CheckBox localCheckBox2 = (CheckBox)findViewById(2131165329);
    if ((!(localCheckBox1.isChecked())) && (!(localCheckBox2.isChecked())))
    {
      Toast.makeText(this, 2131034239, 1).show();
      label45: return;
    }
    int i = 0;
    if (localCheckBox1.isChecked())
      i = 0 + 1;
    if (localCheckBox2.isChecked())
      i += 2;
    if (i == 3)
      this.alarmInfo.setAlarmType(2);
    while (true)
    {
      returnValue();
      break label45:
      if (i == 1)
        this.alarmInfo.setAlarmType(1);
      if (i != 2)
        continue;
      this.alarmInfo.setAlarmType(0);
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    checkExtraData();
    initFrame();
  }

  protected void onPause()
  {
    super.onPause();
    MobclickAgent.onPause(this);
  }

  protected void onResume()
  {
    super.onResume();
    MobclickAgent.onResume(this);
    App.getApp().getActivitysHolder().regCurrentActivity(this);
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.powerremember.uis.task.taskEdit.alarm.AlarmEditActivity
 * JD-Core Version:    0.5.3
 */